# -*- coding: utf-8 -*-
import requests
import time
from lxml import etree
from sport import Sport
import re
import pytz
from datetime import datetime


def print_info(info):
    current_time = datetime.now()
    print(f'{current_time.strftime("%m-%d %H:%M:%S")}   {info}')


class HGA:
    session = requests.Session()
    langx = 'en-us',  # en-us zh-cn
    uid = ''
    ver = ''
    headers = {
        'Host': 'hga050.com',
        # 'Cookie': 'CookieChk=WQ==; protocolstr=aHR0cHM=; cu=Tg==; cuipv6=Tg==; ipv6=Tg==; loadBB=WQ==',
        'Sec-Ch-Ua': '"Chromium";v="121", "Not A(Brand";v="99"',
        'Sec-Ch-Ua-Platform': '"Windows"',
        'Sec-Ch-Ua-Mobile': '?0',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
        'Content-Type': 'application/x-www-form-urlencoded',
        'Accept': '*/*',
        'Origin': 'https://hga050.com',
        'Sec-Fetch-Site': 'same-origin',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Dest': 'empty',
        'Referer': 'https://hga050.com/',
        'Accept-Encoding': 'gzip, deflate, br',
        'Accept-Language': 'zh-CN,zh;q=0.9',
        'Priority': 'u=1, i',
        'Connection': 'keep-alive'
    }

    def findver(self):
        url = 'https://hga050.com'
        data = {
            'detection':'Y'
        }
        response = self.session.post(url, headers=self.headers,data=data)
        pattern = r"top\.ver\s*=\s*'([^']+)'"
        match = re.search(pattern, response.text)
        print_info(match)
        if match:
            result = match.group(1)
            print(result)  # 输出
            self.ver = result
        else:
            print_info('hga050.com的版本号错误')



    def  login(self):
        # URL with query parameters
        url = 'https://hga050.com/transform.php'

        # Headers as a dictionary


        # Request body as a dictionary
        data = {
            'p': 'chk_login',
            'langx': self.langx,
            'ver': self.ver,
            'username': 'study0319',
            'password': 'study2025222',
            'app': 'N',
            'auto': 'GIACAZ',
            'blackbox': '',
            'userAgent': '5'
        }

        # Create a session to handle cookies


        # Send the POST request
        response = self.session.post(url, headers=self.headers, data=data)

        # Check if the request was successful
        if response.status_code == 200:
            print_info('请求成功!')
            print_info(response.text)
            cookies = self.session.cookies
            print_info(dict(cookies))
            xml_bytes = response.text.encode('utf-8')
            root = etree.fromstring(xml_bytes)
            print_info(root.xpath("//uid")[0].text)
            self.uid = root.xpath("//uid")[0].text
            #for child in root:
                #print(child.tag, child.attrib, child.text)

        else:
            print_info('请求失败，状态码:', response.status_code)

    def check_login(self):
        data = {
            'p':'service_mainget',
            'ver':self.ver,
            'langx':self.langx,
            'uid':self.uid,
            'login':'Y'
        }
        url = 'https://hga050.com/transform.php'
        response = self.session.post(url, headers=self.headers, data=data)

        # Check if the request was successful
        if response.status_code == 200:
            xml_bytes = response.text.encode('utf-8')
            root = etree.fromstring(xml_bytes)
            code_node = root.find('code')
            code_value = code_node.text if code_node is not None else None
            if '619' == code_value:
                print_info('状态正常')
            else:
                print_info(f'状态异常，重新登录，错误码:{response.text}')
                time.sleep(5)
                self.login()
        else:
            print_info('请求失败，状态码:', response.status_code)

    def today(self):
        data = {
            'uid': self.uid,
            'ver': self.ver,
            'langx': self.langx,#en-us zh-cn
            'p': 'get_game_list',
            'p3type': '',
            'date': '',
            'gtype': 'ft',
            'showtype': 'today',
            'rtype': 'r',
            'ltype': '3',
            'filter': 'Next1',
            'cupFantasy': 'N',
            'sorttype': 'L',
            'specialClick': '',
            'isFantasy': 'N',
            'ts': int(time.time()*1000)
        }
        url = 'https://hga050.com/transform.php'
        response = self.session.post(url, headers=self.headers, data=data)

        # Check if the request was successful
        if response.status_code == 200:
            print_info('请求成功!')
            print_info(response.text)
            xml_bytes = response.text.encode('utf-8')
            root = etree.fromstring(xml_bytes)
            games = root.xpath('//game')
            sports = []
            for game in games:
                sport = Sport(game.xpath('TEAM_H/text()')[0],game.xpath('TEAM_C/text()')[0],game.xpath('LEAGUE/text()')[0])
                sport.start_time = convert_to_timestamp(game.xpath('DATETIME/text()')[0])
                sport.sport_id = game.get('id')
                if 'N' == game.xpath('ISFANTASY/text()')[0]:
                    sports.append(sport)
                    print_info(f'sport: {sport}')
            return sports
        else:
            print_info('请求失败，状态码:', response.status_code)

    def pkdata(self,gid,wtype,chose_team):
        """"
            获取限额和赔率 ,附加盘要重新找gid
            会得到<fast_check>RC</fast_check>，取RC，作为下一个请求下注的rtype
            response=<?xml version="1.0" encoding="UTF-8"?><serverresponse sip='174.137'><dataCount>6</dataCount><totalDataCount>6</totalDataCount><pageCount>1</pageCount><ec id="ec9297900" hasEC="Y" myGame="ft"><game id="7715777"><SHOWTYPE>ft</SHOWTYPE><GID>7715777</GID><DATETIME>03-27 04:00p</DATETIME><LID>100030</LID><LEAGUE>西班牙甲组联赛</LEAGUE><GIDM>6592543</GIDM><GNUM_H>400090</GNUM_H><GNUM_C>400089</GNUM_C><TEAM_H_ID>101470</TEAM_H_ID><TEAM_C_ID>102044</TEAM_C_ID><TEAM_H>巴塞罗那</TEAM_H><TEAM_C>奥萨苏纳</TEAM_C><ISMASTER>Y</ISMASTER><STRONG>H</STRONG><RETIMESET></RETIMESET><MORE>96</MORE><HIDE_N>N</HIDE_N><PTYPE_MAP>0</PTYPE_MAP><PTYPE></PTYPE><IMPORTANT>N</IMPORTANT><HGID>7715778</HGID><HSTRONG>H</HSTRONG><FLAG_CLASS>flag_ES</FLAG_CLASS><ECID>9297900</ECID><NOW_MODEL>HT</NOW_MODEL><SCORE_H></SCORE_H><SCORE_C></SCORE_C><LASTESTSCORE></LASTESTSCORE><REDCARD_H></REDCARD_H><REDCARD_C></REDCARD_C><TV_WEB_SW>Y</TV_WEB_SW><TV_PH_SW>Y</TV_PH_SW><EVENTID>8DB7C8C6CECCBAB6CABCBBBCBDB6CCCCB9B6CEC6CACCB8CCB7CCBDB7CACCBBBCBAB6CFC6C8C7C7CCB9C6CCC6CCBCB6CCB9B7C7C7C38CCBCACDC6CAC9CBA9B3</EVENTID><CENTER_TV>perform</CENTER_TV><PFCOLOR_H>0000FF</PFCOLOR_H><PFCOLOR_C>FF0000</PFCOLOR_C><MT>br</MT><MT_ID>59070997</MT_ID><MT_GTYPE>FT</MT_GTYPE><MT_SPID>1</MT_SPID><MT_LINEUPS>Y</MT_LINEUPS><FT_SCROE_H></FT_SCROE_H><FT_SCROE_C></FT_SCROE_C><ET_SCROE_H></ET_SCROE_H><ET_SCROE_C></ET_SCROE_C><FANTASY_DATA>No Fantasy Data</FANTASY_DATA><ISFANTASY>N</ISFANTASY><HNIKE></HNIKE><MIDFIELD></MIDFIELD><RUNNING>Y</RUNNING><GOPEN>Y</GOPEN><HGOPEN>Y</HGOPEN><TIMEEDITPOINT></TIMEEDITPOINT><RATIO_R>2</RATIO_R><IOR_RH>0.820</IOR_RH><IOR_RC>1.070</IOR_RC><RATIO_OUO>3.5 / 4</RATIO_OUO><RATIO_OUU>3.5 / 4</RATIO_OUU><IOR_OUH>0.850</IOR_OUH><IOR_OUC>1.040</IOR_OUC><IOR_MH>1.20</IOR_MH><IOR_MC>12.50</IOR_MC><IOR_MN>7.70</IOR_MN><IOR_EOO>1.94</IOR_EOO><IOR_EOE>1.94</IOR_EOE><RATIO_HR>1</RATIO_HR><IOR_HRH>1.050</IOR_HRH><IOR_HRC>0.840</IOR_HRC><RATIO_HOUO>1.5</RATIO_HOUO><RATIO_HOUU>1.5</RATIO_HOUU><IOR_HOUH>1.010</IOR_HOUH><IOR_HOUC>0.870</IOR_HOUC><IOR_HMH>1.52</IOR_HMH><IOR_HMC>8.90</IOR_HMC><IOR_HMN>3.20</IOR_HMN><IOR_TSY>1.81</IOR_TSY><IOR_TSN>2.01</IOR_TSN><TQ_COUNT>0</TQ_COUNT><PD_COUNT>1</PD_COUNT><R_COUNT>4</R_COUNT><OU_COUNT>4</OU_COUNT><CN_COUNT>1</CN_COUNT><RN_COUNT>1</RN_COUNT><WI_COUNT>0</WI_COUNT><ET_COUNT>0</ET_COUNT><PK_COUNT>0</PK_COUNT><SFS_COUNT>1</SFS_COUNT><SYSTIME>2025-03-27 15:58:34</SYSTIME><IS_RB>N</IS_RB></game></ec><ec id="ec9302071" hasEC="Y" myGame="ft"><game id="7719053"><SHOWTYPE>ft</SHOWTYPE><GID>7719053</GID><DATETIME>03-27 04:00p</DATETIME><LID>100127</LID><LEAGUE>英格兰甲组联赛</LEAGUE><GIDM>6594754</GIDM><GNUM_H>400126</GNUM_H><GNUM_C>400125</GNUM_C><TEAM_H_ID>102054</TEAM_H_ID><TEAM_C_ID>104268</TEAM_C_ID><TEAM_H>奥连特</TEAM_H><TEAM_C>斯蒂文尼奇</TEAM_C><ISMASTER>Y</ISMASTER><STRONG>H</STRONG><RETIMESET></RETIMESET><MORE>80</MORE><HIDE_N>N</HIDE_N><PTYPE_MAP>0</PTYPE_MAP><PTYPE></PTYPE><IMPORTANT>N</IMPORTANT><HGID>7719054</HGID><HSTRONG>H</HSTRONG><FLAG_CLASS>flag_GB_ENG</FLAG_CLASS><ECID>9302071</ECID><NOW_MODEL>HT</NOW_MODEL><SCORE_H></SCORE_H><SCORE_C></SCORE_C><LASTESTSCORE></LASTESTSCORE><REDCARD_H></REDCARD_H><REDCARD_C></REDCARD_C><TV_WEB_SW>Y</TV_WEB_SW><TV_PH_SW>Y</TV_PH_SW><EVENTID>88C7CEBCBCBCB8C6CAB7C8C6CDC6CFCCBDBCB8C7CDBCB9C6CEB6CCBCBABCBAB6CEB7C9B6CCBCB7C7C9CCB8C7C9B6CECCBBB7C38BCAC8CBC6CAC9CBA9B3</EVENTID><CENTER_TV>perform</CENTER_TV><PFCOLOR_H>FF0000</PFCOLOR_H><PFCOLOR_C>33CCCC</PFCOLOR_C><MT>br</MT><MT_ID>51093985</MT_ID><MT_GTYPE>FT</MT_GTYPE><MT_SPID>1</MT_SPID><MT_LINEUPS>N</MT_LINEUPS><FT_SCROE_H></FT_SCROE_H><FT_SCROE_C></FT_SCROE_C><ET_SCROE_H></ET_SCROE_H><ET_SCROE_C></ET_SCROE_C><FANTASY_DATA>No Fantasy Data</FANTASY_DATA><ISFANTASY>N</ISFANTASY><HNIKE></HNIKE><MIDFIELD></MIDFIELD><RUNNING>Y</RUNNING><GOPEN>Y</GOPEN><HGOPEN>Y</HGOPEN><TIMEEDITPOINT></TIMEEDITPOINT><RATIO_R>0 / 0.5</RATIO_R><IOR_RH>1.050</IOR_RH><IOR_RC>0.830</IOR_RC><RATIO_OUO>2 / 2.5</RATIO_OUO><RATIO_OUU>2 / 2.5</RATIO_OUU><IOR_OUH>0.800</IOR_OUH><IOR_OUC>1.060</IOR_OUC><IOR_MH>2.36</IOR_MH><IOR_MC>3.00</IOR_MC><IOR_MN>2.89</IOR_MN><IOR_EOO>1.97</IOR_EOO><IOR_EOE>1.91</IOR_EOE><RATIO_HR>0</RATIO_HR><IOR_HRH>0.720</IOR_HRH><IOR_HRC>1.160</IOR_HRC><RATIO_HOUO>0.5 / 1</RATIO_HOUO><RATIO_HOUU>0.5 / 1</RATIO_HOUU><IOR_HOUH>1.110</IOR_HOUH><IOR_HOUC>0.750</IOR_HOUC><IOR_HMH>3.05</IOR_HMH><IOR_HMC>3.90</IOR_HMC><IOR_HMN>1.86</IOR_HMN><IOR_TSY>1.94</IOR_TSY><IOR_TSN>1.84</IOR_TSN><TQ_COUNT>0</TQ_COUNT><PD_COUNT>1</PD_COUNT><R_COUNT>3</R_COUNT><OU_COUNT>3</OU_COUNT><CN_COUNT>1</CN_COUNT><RN_COUNT>0</RN_COUNT><WI_COUNT>0</WI_COUNT><ET_COUNT>0</ET_COUNT><PK_COUNT>0</PK_COUNT><SFS_COUNT>0</SFS_COUNT><SYSTIME>2025-03-27 15:58:34</SYSTIME><IS_RB>N</IS_RB></game></ec><ec id="ec9304491" hasEC="Y" myGame="ft"><game id="7720611"><SHOWTYPE>ft</SHOWTYPE><GID>7720611</GID><DATETIME>03-27 04:00p</DATETIME><LID>101371</LID><LEAGUE>欧洲女子冠军联赛</LEAGUE><GIDM>6596132</GIDM><GNUM_H>400194</GNUM_H><GNUM_C>400193</GNUM_C><TEAM_H_ID>155001</TEAM_H_ID><TEAM_C_ID>154854</TEAM_C_ID><TEAM_H>切尔西(女)</TEAM_H><TEAM_C>曼城(女)</TEAM_C><ISMASTER>Y</ISMASTER><STRONG>H</STRONG><RETIMESET></RETIMESET><MORE>42</MORE><HIDE_N>N</HIDE_N><PTYPE_MAP>0</PTYPE_MAP><PTYPE></PTYPE><IMPORTANT>N</IMPORTANT><HGID>7720612</HGID><HSTRONG>H</HSTRONG><FLAG_CLASS>flag_EU</FLAG_CLASS><ECID>9304491</ECID><NOW_MODEL>HT</NOW_MODEL><SCORE_H></SCORE_H><SCORE_C></SCORE_C><LASTESTSCORE></LASTESTSCORE><REDCARD_H></REDCARD_H><REDCARD_C></REDCARD_C><TV_WEB_SW>N</TV_WEB_SW><TV_PH_SW>N</TV_PH_SW><EVENTID></EVENTID><CENTER_TV></CENTER_TV><PFCOLOR_H>0000FF</PFCOLOR_H><PFCOLOR_C>33CCCC</PFCOLOR_C><MT>br</MT><MT_ID>57889535</MT_ID><MT_GTYPE>FT</MT_GTYPE><MT_SPID>1</MT_SPID><MT_LINEUPS>Y</MT_LINEUPS><FT_SCROE_H></FT_SCROE_H><FT_SCROE_C></FT_SCROE_C><ET_SCROE_H></ET_SCROE_H><ET_SCROE_C></ET_SCROE_C><FANTASY_DATA>No Fantasy Data</FANTASY_DATA><ISFANTASY>N</ISFANTASY><HNIKE></HNIKE><MIDFIELD></MIDFIELD><RUNNING>Y</RUNNING><GOPEN>Y</GOPEN><HGOPEN>Y</HGOPEN><TIMEEDITPOINT></TIMEEDITPOINT><RATIO_R>1 / 1.5</RATIO_R><IOR_RH>0.830</IOR_RH><IOR_RC>0.990</IOR_RC><RATIO_OUO>3 / 3.5</RATIO_OUO><RATIO_OUU>3 / 3.5</RATIO_OUU><IOR_OUH>0.860</IOR_OUH><IOR_OUC>0.940</IOR_OUC><IOR_MH>1.35</IOR_MH><IOR_MC>5.90</IOR_MC><IOR_MN>4.70</IOR_MN><IOR_EOO>1.94</IOR_EOO><IOR_EOE>1.94</IOR_EOE><RATIO_HR>0.5</RATIO_HR><IOR_HRH>0.890</IOR_HRH><IOR_HRC>0.930</IOR_HRC><RATIO_HOUO>1 / 1.5</RATIO_HOUO><RATIO_HOUU>1 / 1.5</RATIO_HOUU><IOR_HOUH>0.930</IOR_HOUH><IOR_HOUC>0.870</IOR_HOUC><IOR_HMH>1.89</IOR_HMH><IOR_HMC>5.30</IOR_HMC><IOR_HMN>2.47</IOR_HMN><IOR_TSY>1.69</IOR_TSY><IOR_TSN>2.09</IOR_TSN><TQ_COUNT>0</TQ_COUNT><PD_COUNT>1</PD_COUNT><R_COUNT>2</R_COUNT><OU_COUNT>2</OU_COUNT><CN_COUNT>0</CN_COUNT><RN_COUNT>0</RN_COUNT><WI_COUNT>0</WI_COUNT><ET_COUNT>0</ET_COUNT><PK_COUNT>0</PK_COUNT><SFS_COUNT>0</SFS_COUNT><SYSTIME>2025-03-27 15:58:34</SYSTIME><IS_RB>N</IS_RB></game></ec><ec id="ec9262517" hasEC="Y" myGame="ft"><game id="7695149"><SHOWTYPE>ft</SHOWTYPE><GID>7695149</GID><DATETIME>03-27 04:30p</DATETIME><LID>102898</LID><LEAGUE>秘鲁甲组联赛</LEAGUE><GIDM>6567192</GIDM><GNUM_H>400008</GNUM_H><GNUM_C>400007</GNUM_C><TEAM_H_ID>135196</TEAM_H_ID><TEAM_C_ID>135197</TEAM_C_ID><TEAM_H>阿亚库乔</TEAM_H><TEAM_C>梅加</TEAM_C><ISMASTER>Y</ISMASTER><STRONG>C</STRONG><RETIMESET></RETIMESET><MORE>42</MORE><HIDE_N>N</HIDE_N><PTYPE_MAP>0</PTYPE_MAP><PTYPE></PTYPE><IMPORTANT>N</IMPORTANT><HGID>7695150</HGID><HSTRONG>C</HSTRONG><FLAG_CLASS>flag_PE</FLAG_CLASS><ECID>9262517</ECID><NOW_MODEL>HT</NOW_MODEL><SCORE_H></SCORE_H><SCORE_C></SCORE_C><LASTESTSCORE></LASTESTSCORE><REDCARD_H></REDCARD_H><REDCARD_C></REDCARD_C><TV_WEB_SW>N</TV_WEB_SW><TV_PH_SW>N</TV_PH_SW><EVENTID></EVENTID><CENTER_TV></CENTER_TV><PFCOLOR_H>FFFFFF</PFCOLOR_H><PFCOLOR_C>FFFF00</PFCOLOR_C><MT>br</MT><MT_ID>58834537</MT_ID><MT_GTYPE>FT</MT_GTYPE><MT_SPID>1</MT_SPID><MT_LINEUPS>Y</MT_LINEUPS><FT_SCROE_H></FT_SCROE_H><FT_SCROE_C></FT_SCROE_C><ET_SCROE_H></ET_SCROE_H><ET_SCROE_C></ET_SCROE_C><FANTASY_DATA>No Fantasy Data</FANTASY_DATA><ISFANTASY>N</ISFANTASY><HNIKE></HNIKE><MIDFIELD></MIDFIELD><RUNNING>Y</RUNNING><GOPEN>Y</GOPEN><HGOPEN>Y</HGOPEN><TIMEEDITPOINT></TIMEEDITPOINT><RATIO_R>0.5 / 1</RATIO_R><IOR_RH>1.030</IOR_RH><IOR_RC>0.790</IOR_RC><RATIO_OUO>2.5</RATIO_OUO><RATIO_OUU>2.5</RATIO_OUU><IOR_OUH>0.860</IOR_OUH><IOR_OUC>0.940</IOR_OUC><IOR_MH>4.55</IOR_MH><IOR_MC>1.58</IOR_MC><IOR_MN>3.75</IOR_MN><IOR_EOO>1.94</IOR_EOO><IOR_EOE>1.94</IOR_EOE><RATIO_HR>0 / 0.5</RATIO_HR><IOR_HRH>1.010</IOR_HRH><IOR_HRC>0.810</IOR_HRC><RATIO_HOUO>1</RATIO_HOUO><RATIO_HOUU>1</RATIO_HOUU><IOR_HOUH>0.990</IOR_HOUH><IOR_HOUC>0.810</IOR_HOUC><IOR_HMH>4.80</IOR_HMH><IOR_HMC>2.21</IOR_HMC><IOR_HMN>2.17</IOR_HMN><IOR_TSY>1.9</IOR_TSY><IOR_TSN>1.84</IOR_TSN><TQ_COUNT>0</TQ_COUNT><PD_COUNT>1</PD_COUNT><R_COUNT>2</R_COUNT><OU_COUNT>2</OU_COUNT><CN_COUNT>0</CN_COUNT><RN_COUNT>0</RN_COUNT><WI_COUNT>0</WI_COUNT><ET_COUNT>0</ET_COUNT><PK_COUNT>0</PK_COUNT><SFS_COUNT>0</SFS_COUNT><SYSTIME>2025-03-27 15:58:34</SYSTIME><IS_RB>N</IS_RB></game></ec><ec id="ec9304792" hasEC="Y" myGame="ft"><game id="7720715"><SHOWTYPE>ft</SHOWTYPE><GID>7720715</GID><DATETIME>03-27 04:30p</DATETIME><LID>107696</LID><LEAGUE>厄瓜多尔乙组联赛</LEAGUE><GIDM>6596309</GIDM><GNUM_H>400380</GNUM_H><GNUM_C>400379</GNUM_C><TEAM_H_ID>210320</TEAM_H_ID><TEAM_C_ID>177243</TEAM_C_ID><TEAM_H>北莱昂内斯</TEAM_H><TEAM_C>十月九</TEAM_C><ISMASTER>Y</ISMASTER><STRONG>H</STRONG><RETIMESET></RETIMESET><MORE>42</MORE><HIDE_N>N</HIDE_N><PTYPE_MAP>0</PTYPE_MAP><PTYPE></PTYPE><IMPORTANT>N</IMPORTANT><HGID>7720716</HGID><HSTRONG>H</HSTRONG><FLAG_CLASS>flag_EC</FLAG_CLASS><ECID>9304792</ECID><NOW_MODEL>HT</NOW_MODEL><SCORE_H></SCORE_H><SCORE_C></SCORE_C><LASTESTSCORE></LASTESTSCORE><REDCARD_H></REDCARD_H><REDCARD_C></REDCARD_C><TV_WEB_SW>N</TV_WEB_SW><TV_PH_SW>N</TV_PH_SW><EVENTID></EVENTID><CENTER_TV></CENTER_TV><PFCOLOR_H>FFFF00</PFCOLOR_H><PFCOLOR_C>0000FF</PFCOLOR_C><MT>br</MT><MT_ID>58379517</MT_ID><MT_GTYPE>FT</MT_GTYPE><MT_SPID>1</MT_SPID><MT_LINEUPS>N</MT_LINEUPS><FT_SCROE_H></FT_SCROE_H><FT_SCROE_C></FT_SCROE_C><ET_SCROE_H></ET_SCROE_H><ET_SCROE_C></ET_SCROE_C><FANTASY_DATA>No Fantasy Data</FANTASY_DATA><ISFANTASY>N</ISFANTASY><HNIKE></HNIKE><MIDFIELD></MIDFIELD><RUNNING>Y</RUNNING><GOPEN>Y</GOPEN><HGOPEN>Y</HGOPEN><TIMEEDITPOINT></TIMEEDITPOINT><RATIO_R>0.5 / 1</RATIO_R><IOR_RH>0.870</IOR_RH><IOR_RC>0.950</IOR_RC><RATIO_OUO>2</RATIO_OUO><RATIO_OUU>2</RATIO_OUU><IOR_OUH>0.830</IOR_OUH><IOR_OUC>0.970</IOR_OUC><IOR_MH>1.65</IOR_MH><IOR_MC>5.20</IOR_MC><IOR_MN>3.30</IOR_MN><IOR_EOO>1.97</IOR_EOO><IOR_EOE>1.91</IOR_EOE><RATIO_HR>0 / 0.5</RATIO_HR><IOR_HRH>0.870</IOR_HRH><IOR_HRC>0.950</IOR_HRC><RATIO_HOUO>0.5 / 1</RATIO_HOUO><RATIO_HOUU>0.5 / 1</RATIO_HOUU><IOR_HOUH>0.980</IOR_HOUH><IOR_HOUC>0.820</IOR_HOUC><IOR_HMH>2.33</IOR_HMH><IOR_HMC>5.80</IOR_HMC><IOR_HMN>1.92</IOR_HMN><IOR_TSY>2.61</IOR_TSY><IOR_TSN>1.46</IOR_TSN><TQ_COUNT>0</TQ_COUNT><PD_COUNT>1</PD_COUNT><R_COUNT>2</R_COUNT><OU_COUNT>2</OU_COUNT><CN_COUNT>0</CN_COUNT><RN_COUNT>0</RN_COUNT><WI_COUNT>0</WI_COUNT><ET_COUNT>0</ET_COUNT><PK_COUNT>0</PK_COUNT><SFS_COUNT>0</SFS_COUNT><SYSTIME>2025-03-27 15:58:34</SYSTIME><IS_RB>N</IS_RB></game></ec><ec id="ec9317726" hasEC="Y" myGame="ft"><game id="7729099"><SHOWTYPE>ft</SHOWTYPE><GID>7729099</GID><DATETIME>03-27 04:00p</DATETIME><LID>108688</LID><LEAGUE>奇幻赛事</LEAGUE><GIDM>6604080</GIDM><GNUM_H>400778</GNUM_H><GNUM_C>400777</GNUM_C><TEAM_H_ID>101470</TEAM_H_ID><TEAM_C_ID>104134</TEAM_C_ID><TEAM_H>巴塞罗那</TEAM_H><TEAM_C>科洛科洛</TEAM_C><ISMASTER>Y</ISMASTER><STRONG>H</STRONG><RETIMESET></RETIMESET><MORE>31</MORE><HIDE_N>N</HIDE_N><PTYPE_MAP>0</PTYPE_MAP><PTYPE></PTYPE><IMPORTANT>N</IMPORTANT><HGID>7729100</HGID><HSTRONG>H</HSTRONG><FLAG_CLASS>flag_otFM</FLAG_CLASS><ECID>9317726</ECID><NOW_MODEL>HT</NOW_MODEL><SCORE_H></SCORE_H><SCORE_C></SCORE_C><LASTESTSCORE></LASTESTSCORE><REDCARD_H></REDCARD_H><REDCARD_C></REDCARD_C><TV_WEB_SW>N</TV_WEB_SW><TV_PH_SW>N</TV_PH_SW><EVENTID></EVENTID><CENTER_TV></CENTER_TV><PFCOLOR_H>0000FF</PFCOLOR_H><PFCOLOR_C>000000</PFCOLOR_C><MT></MT><MT_ID></MT_ID><MT_GTYPE>FT</MT_GTYPE><MT_SPID></MT_SPID><MT_LINEUPS>N</MT_LINEUPS><FT_SCROE_H></FT_SCROE_H><FT_SCROE_C></FT_SCROE_C><ET_SCROE_H></ET_SCROE_H><ET_SCROE_C></ET_SCROE_C><FANTASY_DATA><GAMEC_TEAM_C_ID>104223</GAMEC_TEAM_C_ID><GAMEC_LEAGUE_ID>100276</GAMEC_LEAGUE_ID><GAMEC_LEAGUE>智利甲组联赛</GAMEC_LEAGUE><GAMEH_LEAGUE>西班牙甲组联赛</GAMEH_LEAGUE><GAMEH_TEAM_H>巴塞罗那</GAMEH_TEAM_H><GAMEC_TEAM_H_ID>104134</GAMEC_TEAM_H_ID><GAMEC_DATETIME>03-27 05:15p</GAMEC_DATETIME><GAMEH_TEAM_H_ID>101470</GAMEH_TEAM_H_ID><GAMEC_TEAM_C>帕勒斯蒂诺</GAMEC_TEAM_C><GAMEH_TEAM_C>奥萨苏纳</GAMEH_TEAM_C><GAMEH_GID>7715777</GAMEH_GID><GAMEC_ECID>9263014</GAMEC_ECID><GAMEH_TEAM_C_ID>102044</GAMEH_TEAM_C_ID><GAMEH_DATETIME>03-27 04:00p</GAMEH_DATETIME><GAMEC_TEAM_H>科洛科洛</GAMEC_TEAM_H><GAMEH_LEAGUE_ID>100030</GAMEH_LEAGUE_ID><GAMEC_GID>7695435</GAMEC_GID><GAMEH_ECID>9297900</GAMEH_ECID></FANTASY_DATA><ISFANTASY>Y</ISFANTASY><HNIKE></HNIKE><MIDFIELD>Y</MIDFIELD><RUNNING>N</RUNNING><GOPEN>Y</GOPEN><HGOPEN>Y</HGOPEN><TIMEEDITPOINT></TIMEEDITPOINT><RATIO_R>1.5</RATIO_R><IOR_RH>0.980</IOR_RH><IOR_RC>0.840</IOR_RC><RATIO_OUO>5</RATIO_OUO><RATIO_OUU>5</RATIO_OUU><IOR_OUH>0.820</IOR_OUH><IOR_OUC>0.980</IOR_OUC><IOR_MH>1.41</IOR_MH><IOR_MC>4.50</IOR_MC><IOR_MN>5.30</IOR_MN><IOR_EOO>1.94</IOR_EOO><IOR_EOE>1.94</IOR_EOE><RATIO_HR>0.5</RATIO_HR><IOR_HRH>0.830</IOR_HRH><IOR_HRC>0.990</IOR_HRC><RATIO_HOUO>2</RATIO_HOUO><RATIO_HOUU>2</RATIO_HOUU><IOR_HOUH>1.010</IOR_HOUH><IOR_HOUC>0.790</IOR_HOUC><IOR_HMH>1.83</IOR_HMH><IOR_HMC>3.95</IOR_HMC><IOR_HMN>3.15</IOR_HMN><IOR_TSY>1.16</IOR_TSY><IOR_TSN>4.75</IOR_TSN><SYSTIME>2025-03-27 15:58:34</SYSTIME><IS_RB>N</IS_RB></game></ec><ts>1743105514234</ts><nowClickTabTs></nowClickTabTs><mygame_rtype>r</mygame_rtype><system_time>2025-03-27 15:58:34</system_time><nowShowtype>today</nowShowtype><original>{"GAME_0":{"IOR_HRC":"0.840","PTYPE":"","HNIKE":"","FT_SCROE_H":"","IOR_HRH":"1.050","FT_SCROE_C":"","HIDE_N":"N","GAME_DATE_TIME":"2025-03-27 16:00:00","RATIO_R":"2","LASTESTSCORE":"","FLAG_CLASS":"flag_ES","ECID":"9297900","MT_GTYPE":"FT","GOPEN":"Y","RATIO_HOUU":"1.5","GID":"7715777","TEAM_C":"奥萨苏纳","HGOPEN":"Y","TEAM_H":"巴塞罗那","RUNNING":"Y","CENTER_TV":"perform","MT":"br","IMPORTANT":"N","MT_SPID":"1","EVENTID":"8DB7C8C6CECCBAB6CABCBBBCBDB6CCCCB9B6CEC6CACCB8CCB7CCBDB7CACCBBBCBAB6CFC6C8C7C7CCB9C6CCC6CCBCB6CCB9B7C7C7C38CCBCACDC6CAC9CBA9B3","IOR_EOE":"1.94","IOR_HMC":"8.90","RATIO_HOUO":"1.5","IOR_HMN":"3.20","LEAGUE":"西班牙甲组联赛","IOR_HMH":"1.52","SHOWTYPE":"ft","IOR_EOO":"1.94","IOR_HOUH":"1.010","IOR_TSY":"1.81","SCORE_H":"","IOR_HOUC":"0.870","IOR_MN":"7.70","FANTASY_DATA":"No Fantasy Data","TV_WEB_SW":"Y","RATIO_HR":"1","TEAM_H_ID":"101470","PFCOLOR_C":"FF0000","GIDM":"6592543","ISFANTASY":"N","PTYPE_MAP":"0","PFCOLOR_H":"0000FF","SCORE_C":"","GNUM_H":"400090","NOW_MODEL":"HT","RETIMESET":"","MIDFIELD":"","REDCARD_C":"","MT_ID":"59070997","GNUM_C":"400089","IOR_MC":"12.50","SORT_KEY":"00000010910_Spain Primera Division_0_2025-03-27_16:00:00_00000000010_00006592543_00000400089","REDCARD_H":"","IOR_MH":"1.20","ET_SCROE_H":"","RATIO_OUU":"3.5 / 4","TEAM_C_ID":"102044","LID":"100030","IOR_OUH":"0.850","TV_PH_SW":"Y","RATIO_OUO":"3.5 / 4","IOR_OUC":"1.040","MORE":96,"DATETIME":"03-27 04:00p","IOR_RC":"1.070","HSTRONG":"H","ISMASTER":"Y","IOR_RH":"0.820","IOR_TSN":"2.01","HGID":"7715778","ET_SCROE_C":"","MT_LINEUPS":"Y","TIMEEDITPOINT":"","STRONG":"H"},"GAME_1":{"IOR_HRC":"1.160","PTYPE":"","HNIKE":"","FT_SCROE_H":"","IOR_HRH":"0.720","FT_SCROE_C":"","HIDE_N":"N","GAME_DATE_TIME":"2025-03-27 16:00:00","RATIO_R":"0 / 0.5","LASTESTSCORE":"","FLAG_CLASS":"flag_GB_ENG","ECID":"9302071","MT_GTYPE":"FT","GOPEN":"Y","RATIO_HOUU":"0.5 / 1","GID":"7719053","TEAM_C":"斯蒂文尼奇","HGOPEN":"Y","TEAM_H":"奥连特","RUNNING":"Y","CENTER_TV":"perform","MT":"br","IMPORTANT":"N","MT_SPID":"1","EVENTID":"88C7CEBCBCBCB8C6CAB7C8C6CDC6CFCCBDBCB8C7CDBCB9C6CEB6CCBCBABCBAB6CEB7C9B6CCBCB7C7C9CCB8C7C9B6CECCBBB7C38BCAC8CBC6CAC9CBA9B3","IOR_EOE":"1.91","IOR_HMC":"3.90","RATIO_HOUO":"0.5 / 1","IOR_HMN":"1.86","LEAGUE":"英格兰甲组联赛","IOR_HMH":"3.05","SHOWTYPE":"ft","IOR_EOO":"1.97","IOR_HOUH":"1.110","IOR_TSY":"1.94","SCORE_H":"","IOR_HOUC":"0.750","IOR_MN":"2.89","FANTASY_DATA":"No Fantasy Data","TV_WEB_SW":"Y","RATIO_HR":"0","TEAM_H_ID":"102054","PFCOLOR_C":"33CCCC","GIDM":"6594754","ISFANTASY":"N","PTYPE_MAP":"0","PFCOLOR_H":"FF0000","SCORE_C":"","GNUM_H":"400126","NOW_MODEL":"HT","RETIMESET":"","MIDFIELD":"","REDCARD_C":"","MT_ID":"51093985","GNUM_C":"400125","IOR_MC":"3.00","SORT_KEY":"00000014000_English League 1_0_2025-03-27_16:00:00_00000000010_00006594754_00000400125","REDCARD_H":"","IOR_MH":"2.36","ET_SCROE_H":"","RATIO_OUU":"2 / 2.5","TEAM_C_ID":"104268","LID":"100127","IOR_OUH":"0.800","TV_PH_SW":"Y","RATIO_OUO":"2 / 2.5","IOR_OUC":"1.060","MORE":80,"DATETIME":"03-27 04:00p","IOR_RC":"0.830","HSTRONG":"H","ISMASTER":"Y","IOR_RH":"1.050","IOR_TSN":"1.84","HGID":"7719054","ET_SCROE_C":"","MT_LINEUPS":"N","TIMEEDITPOINT":"","STRONG":"H"},"GAME_2":{"IOR_HRC":"0.930","PTYPE":"","HNIKE":"","FT_SCROE_H":"","IOR_HRH":"0.890","FT_SCROE_C":"","HIDE_N":"N","GAME_DATE_TIME":"2025-03-27 16:00:00","RATIO_R":"1 / 1.5","LASTESTSCORE":"","FLAG_CLASS":"flag_EU","ECID":"9304491","MT_GTYPE":"FT","GOPEN":"Y","RATIO_HOUU":"1 / 1.5","GID":"7720611","TEAM_C":"曼城(女)","HGOPEN":"Y","TEAM_H":"切尔西(女)","RUNNING":"Y","CENTER_TV":"","MT":"br","IMPORTANT":"N","MT_SPID":"1","EVENTID":"","IOR_EOE":"1.94","IOR_HMC":"5.30","RATIO_HOUO":"1 / 1.5","IOR_HMN":"2.47","LEAGUE":"欧洲女子冠军联赛","IOR_HMH":"1.89","SHOWTYPE":"ft","IOR_EOO":"1.94","IOR_HOUH":"0.930","IOR_TSY":"1.69","SCORE_H":"","IOR_HOUC":"0.870","IOR_MN":"4.70","FANTASY_DATA":"No Fantasy Data","TV_WEB_SW":"N","RATIO_HR":"0.5","TEAM_H_ID":"155001","PFCOLOR_C":"33CCCC","GIDM":"6596132","ISFANTASY":"N","PTYPE_MAP":"0","PFCOLOR_H":"0000FF","SCORE_C":"","GNUM_H":"400194","NOW_MODEL":"HT","RETIMESET":"","MIDFIELD":"","REDCARD_C":"","MT_ID":"57889535","GNUM_C":"400193","IOR_MC":"5.90","SORT_KEY":"00000015000_UEFA Women Champions League_0_2025-03-27_16:00:00_00000000010_00006596132_00000400193","REDCARD_H":"","IOR_MH":"1.35","ET_SCROE_H":"","RATIO_OUU":"3 / 3.5","TEAM_C_ID":"154854","LID":"101371","IOR_OUH":"0.860","TV_PH_SW":"N","RATIO_OUO":"3 / 3.5","IOR_OUC":"0.940","MORE":42,"DATETIME":"03-27 04:00p","IOR_RC":"0.990","HSTRONG":"H","ISMASTER":"Y","IOR_RH":"0.830","IOR_TSN":"2.09","HGID":"7720612","ET_SCROE_C":"","MT_LINEUPS":"Y","TIMEEDITPOINT":"","STRONG":"H"},"GAME_3":{"IOR_HRC":"0.810","PTYPE":"","HNIKE":"","FT_SCROE_H":"","IOR_HRH":"1.010","FT_SCROE_C":"","HIDE_N":"N","GAME_DATE_TIME":"2025-03-27 16:30:00","RATIO_R":"0.5 / 1","LASTESTSCORE":"","FLAG_CLASS":"flag_PE","ECID":"9262517","MT_GTYPE":"FT","GOPEN":"Y","RATIO_HOUU":"1","GID":"7695149","TEAM_C":"梅加","HGOPEN":"Y","TEAM_H":"阿亚库乔","RUNNING":"Y","CENTER_TV":"","MT":"br","IMPORTANT":"N","MT_SPID":"1","EVENTID":"","IOR_EOE":"1.94","IOR_HMC":"2.21","RATIO_HOUO":"1","IOR_HMN":"2.17","LEAGUE":"秘鲁甲组联赛","IOR_HMH":"4.80","SHOWTYPE":"ft","IOR_EOO":"1.94","IOR_HOUH":"0.990","IOR_TSY":"1.9","SCORE_H":"","IOR_HOUC":"0.810","IOR_MN":"3.75","FANTASY_DATA":"No Fantasy Data","TV_WEB_SW":"N","RATIO_HR":"0 / 0.5","TEAM_H_ID":"135196","PFCOLOR_C":"FFFF00","GIDM":"6567192","ISFANTASY":"N","PTYPE_MAP":"0","PFCOLOR_H":"FFFFFF","SCORE_C":"","GNUM_H":"400008","NOW_MODEL":"HT","RETIMESET":"","MIDFIELD":"","REDCARD_C":"","MT_ID":"58834537","GNUM_C":"400007","IOR_MC":"1.58","SORT_KEY":"00000017876_Peru Liga 1_0_2025-03-27_16:30:00_00000000010_00006567192_00000400007","REDCARD_H":"","IOR_MH":"4.55","ET_SCROE_H":"","RATIO_OUU":"2.5","TEAM_C_ID":"135197","LID":"102898","IOR_OUH":"0.860","TV_PH_SW":"N","RATIO_OUO":"2.5","IOR_OUC":"0.940","MORE":42,"DATETIME":"03-27 04:30p","IOR_RC":"0.790","HSTRONG":"C","ISMASTER":"Y","IOR_RH":"1.030","IOR_TSN":"1.84","HGID":"7695150","ET_SCROE_C":"","MT_LINEUPS":"Y","TIMEEDITPOINT":"","STRONG":"C"},"GAME_4":{"IOR_HRC":"0.950","PTYPE":"","HNIKE":"","FT_SCROE_H":"","IOR_HRH":"0.870","FT_SCROE_C":"","HIDE_N":"N","GAME_DATE_TIME":"2025-03-27 16:30:00","RATIO_R":"0.5 / 1","LASTESTSCORE":"","FLAG_CLASS":"flag_EC","ECID":"9304792","MT_GTYPE":"FT","GOPEN":"Y","RATIO_HOUU":"0.5 / 1","GID":"7720715","TEAM_C":"十月九","HGOPEN":"Y","TEAM_H":"北莱昂内斯","RUNNING":"Y","CENTER_TV":"","MT":"br","IMPORTANT":"N","MT_SPID":"1","EVENTID":"","IOR_EOE":"1.91","IOR_HMC":"5.80","RATIO_HOUO":"0.5 / 1","IOR_HMN":"1.92","LEAGUE":"厄瓜多尔乙组联赛","IOR_HMH":"2.33","SHOWTYPE":"ft","IOR_EOO":"1.97","IOR_HOUH":"0.980","IOR_TSY":"2.61","SCORE_H":"","IOR_HOUC":"0.820","IOR_MN":"3.30","FANTASY_DATA":"No Fantasy Data","TV_WEB_SW":"N","RATIO_HR":"0 / 0.5","TEAM_H_ID":"210320","PFCOLOR_C":"0000FF","GIDM":"6596309","ISFANTASY":"N","PTYPE_MAP":"0","PFCOLOR_H":"FFFF00","SCORE_C":"","GNUM_H":"400380","NOW_MODEL":"HT","RETIMESET":"","MIDFIELD":"","REDCARD_C":"","MT_ID":"58379517","GNUM_C":"400379","IOR_MC":"5.20","SORT_KEY":"00000018000_Ecuador Serie B_0_2025-03-27_16:30:00_00000000010_00006596309_00000400379","REDCARD_H":"","IOR_MH":"1.65","ET_SCROE_H":"","RATIO_OUU":"2","TEAM_C_ID":"177243","LID":"107696","IOR_OUH":"0.830","TV_PH_SW":"N","RATIO_OUO":"2","IOR_OUC":"0.970","MORE":42,"DATETIME":"03-27 04:30p","IOR_RC":"0.950","HSTRONG":"H","ISMASTER":"Y","IOR_RH":"0.870","IOR_TSN":"1.46","HGID":"7720716","ET_SCROE_C":"","MT_LINEUPS":"N","TIMEEDITPOINT":"","STRONG":"H"},"GAME_5":{"IOR_HRC":"0.990","PTYPE":"","HNIKE":"","FT_SCROE_H":"","IOR_HRH":"0.830","FT_SCROE_C":"","HIDE_N":"N","GAME_DATE_TIME":"2025-03-27 16:00:00","RATIO_R":"1.5","LASTESTSCORE":"","FLAG_CLASS":"flag_otFM","ECID":"9317726","MT_GTYPE":"FT","GOPEN":"Y","RATIO_HOUU":"2","GID":"7729099","TEAM_C":"科洛科洛","HGOPEN":"Y","TEAM_H":"巴塞罗那","RUNNING":"N","CENTER_TV":"","MT":"","IMPORTANT":"N","MT_SPID":"","EVENTID":"","IOR_EOE":"1.94","IOR_HMC":"3.95","RATIO_HOUO":"2","IOR_HMN":"3.15","LEAGUE":"奇幻赛事","IOR_HMH":"1.83","SHOWTYPE":"ft","IOR_EOO":"1.94","IOR_HOUH":"1.010","IOR_TSY":"1.16","SCORE_H":"","IOR_HOUC":"0.790","IOR_MN":"5.30","FANTASY_DATA":{"GAMEC_TEAM_C_ID":"104223","GAMEC_LEAGUE_ID":"100276","GAMEC_LEAGUE":"智利甲组联赛","GAMEH_LEAGUE":"西班牙甲组联赛","GAMEH_TEAM_H":"巴塞罗那","GAMEC_TEAM_H_ID":"104134","GAMEC_DATETIME":"03-27 05:15p","GAMEH_TEAM_H_ID":"101470","GAMEC_TEAM_C":"帕勒斯蒂诺","GAMEH_TEAM_C":"奥萨苏纳","GAMEH_GID":"7715777","GAMEC_ECID":"9263014","GAMEH_TEAM_C_ID":"102044","GAMEH_DATETIME":"03-27 04:00p","GAMEC_TEAM_H":"科洛科洛","GAMEH_LEAGUE_ID":"100030","GAMEC_GID":"7695435","GAMEH_ECID":"9297900"},"TV_WEB_SW":"N","RATIO_HR":"0.5","TEAM_H_ID":"101470","PFCOLOR_C":"000000","GIDM":"6604080","ISFANTASY":"Y","PTYPE_MAP":"0","PFCOLOR_H":"0000FF","SCORE_C":"","GNUM_H":"400778","NOW_MODEL":"HT","RETIMESET":"","MIDFIELD":"Y","REDCARD_C":"","MT_ID":"","GNUM_C":"400777","IOR_MC":"4.50","SORT_KEY":"00000050001_Fantasy Matches_0_2025-03-27_16:00:00_00000000010_00006604080_00000400777","REDCARD_H":"","IOR_MH":"1.41","ET_SCROE_H":"","RATIO_OUU":"5","TEAM_C_ID":"104134","LID":"108688","IOR_OUH":"0.820","TV_PH_SW":"N","RATIO_OUO":"5","IOR_OUC":"0.980","MORE":31,"DATETIME":"03-27 04:00p","IOR_RC":"0.840","HSTRONG":"H","ISMASTER":"Y","IOR_RH":"0.980","IOR_TSN":"4.75","HGID":"7729100","ET_SCROE_C":"","MT_LINEUPS":"N","TIMEEDITPOINT":"","STRONG":"H"}}</original></serverresponse>
        """
        payloay = {
            'p': 'FT_order_view',
            'uid':self.uid,
            'ver': self.ver,
            'langx': self.langx,
            'odd_f_type': 'H',
            'gid': gid,
            'gtype': 'FT',
            'wtype': wtype,#初盘：OU大小,R是让球盘;滚球：
            'chose_team': chose_team#初盘：大小盘 C是大，H是小 ，让球盘主队是H客队是C ;滚球：
        }
        url = 'https://hga050.com/transform.php'
        response = self.session.post(url, headers=self.headers, data=payloay)
        if response.status_code == 200:
            print_info('请求成功!')
            print_info(response.text)
            xml_bytes = response.text.encode('utf-8')
            root = etree.fromstring(xml_bytes)
            gold_gmax = root.xpath('//gold_gmax/text()')[0]
            odd = root.xpath('//ioratio/text()')[0]
            spread = root.xpath('//spread/text()')[0]
            ratio =  root.xpath('//ratio/text()')[0]
            con = root.xpath('//con/text()')[0]
            return [gold_gmax,odd,ratio,con]
        else:
            print_info(f'请求失败，状态码 {response.status_code}')

    def bet(self,gid,wtype,chose_team,money,ioratio,ratio,con):
        payloay = {
            'p': 'FT_bet',
            'uid': self.uid,
            'ver': self.ver,
            'langx': self.langx,
            'odd_f_type': 'H',
            'golds':money,
            'gid': gid,
            'gtype': 'FT',
            'wtype': wtype,  # 初盘：OU大小,R是让球盘;滚球：
            'rtype':wtype+chose_team,
            'chose_team': chose_team , # 初盘：大小盘 C是大，H是小 ，让球盘主队是H客队是C ;滚球：
            'ioratio':ioratio,
            'con':con,#这是盘口 如大球4
            'ratio':ratio,
            'autoOdd':'Y',
            'timestamp':int(time.time()*1000),
            'timestamp2':'',
            'isRB':'N',
            'imp':'N',
            'ptype':'',
            'isYesterday':'N',
            'f':'1R'
        }
        url = 'https://hga050.com/transform.php'
        response = self.session.post(url, headers=self.headers, data=payloay)
        if response.status_code == 200:
            print_info('请求成功!')
            print_info(response.text)
            xml_bytes = response.text.encode('utf-8')
            root = etree.fromstring(xml_bytes)
            code_node = root.find('code')
            code_value = code_node.text if code_node is not None else None
            if '560' == code_value:
                print_info('下注成功')
                return True
            else:
                print_info(f'下注异常，错误码:{response.text}')
                return False
        else:
            print_info('请求失败，状态码:', response.status_code)
            return False


from datetime import datetime, timedelta


def convert_to_timestamp(date_str):
    current_year = datetime.now().year  # 获取当前年份
    # 处理不规范的 AM/PM 缩写
    date_str = date_str.replace("p", "PM").replace("a", "AM")
    # 解析为 naive datetime 对象
    date_obj = datetime.strptime(date_str, "%m-%d %I:%M%p")
    # 设置年份并转换为 UTC-4 时区
    utc_minus_4 = pytz.timezone('Etc/GMT+4')  # 注意：pytz的命名规则为 GMT+X 表示 UTC-X
    date_obj_utc4 = date_obj.replace(year=current_year).replace(tzinfo=utc_minus_4)
    # 转换为UTC时间并计算时间戳
    timestamp = int(date_obj_utc4.astimezone(pytz.UTC).timestamp() * 1000)
    return timestamp


if __name__ == "__main__":
    hg = HGA()
    hg.findver()
    time.sleep(5)
    hg.login()
    time.sleep(5)
    hg.today()
    while True:
        try:
            hg.check_login()
            time.sleep(10)
        except Exception as e:
            # print("Response Text:", response.text)
            print_info(f"请求过程中发生错误：{e}")
    #过滤 奇幻赛事 英文是 ‘Fantasy Matches’
    #假设gid=7739157 ,match=PSV埃因霍温 - 阿尔默勒城, 买大球
    #some = hg.pkdata('7740591','R','C')
    #print(some)
    #hg.bet('7740591','R','C',55,some[1],some[2],some[3])